<html>
<head><meta charset="utf-8"><title>const promotion of static addresses (re: lang team meeting) · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20promotion.20of.20static.20addresses.20(re.3A.20lang.20team.20meeting).html">const promotion of static addresses (re: lang team meeting)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="177914359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20promotion%20of%20static%20addresses%20%28re%3A%20lang%20team%20meeting%29/near/177914359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20promotion.20of.20static.20addresses.20(re.3A.20lang.20team.20meeting).html#177914359">(Oct 11 2019 at 14:53)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> Hi friend. I have a question related to the recent discussion in the lang team meeting.</p>
<p>In my own <a href="https://github.com/rust-console/voladdress" target="_blank" title="https://github.com/rust-console/voladdress">crate</a>, so far I don't have the problem with raw hardware addresses and const eval interacting badly because I ended up making a type (<code>VolAddress&lt;T&gt;</code>) which is internally a <code>NonZeroUsize</code> + <code>PhantomData&lt;T&gt;</code>, and then all the <code>const fn</code> manipulations of this type do const math to offset the address or whatever thing, while the actual reading and writing of the memory (where the address value is cast to <code>*mut T</code> at the last minute) isn't <code>const fn</code> so you simply can't end up writing a <code>const</code> expression where you'd read or write the memory. I think I'm just naturally saved in this situation by the type system.</p>
<p>My question to you is, "does this sound like a sane and correct approach?" or is there perhaps something I missed that would make this a fall down suddenly?</p>



<a name="177990131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20promotion%20of%20static%20addresses%20%28re%3A%20lang%20team%20meeting%29/near/177990131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20promotion.20of.20static.20addresses.20(re.3A.20lang.20team.20meeting).html#177990131">(Oct 12 2019 at 14:04)</a>:</h4>
<p>yeah I'm a fan of that approach :D</p>



<a name="177990143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/const%20promotion%20of%20static%20addresses%20%28re%3A%20lang%20team%20meeting%29/near/177990143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/const.20promotion.20of.20static.20addresses.20(re.3A.20lang.20team.20meeting).html#177990143">(Oct 12 2019 at 14:04)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> you are basically typing your integer addresses as <code>usize</code> instead of using pointers. which in some sense is more correct.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>